﻿using System;
using System.Web.UI.WebControls;
using Token.Piker.BLL;

namespace Token.Piker.Web.Admin.Tag
{
    public partial class List : System.Web.UI.Page
    {
        private TagBLL tagBLL = new TagBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gridView.PageIndex = e.NewPageIndex;
            BindData();
        }

        private void BindData()
        {
            gridView.DataSource = tagBLL.GetAllList();
            gridView.DataBind();
        }

        protected string GetAdderName(object adderID)
        {
            if (adderID == null)
            {
                return string.Empty;
            }
            AdminBLL adminBLL = new AdminBLL();
            int adminID = Convert.ToInt32(adderID);
            Token.Piker.Model.Admin admin = adminBLL.GetModel(adminID);
            return admin.RealName;
        }
    }
}